package ai.plantdata.Behavior.mode.CommandPattern.classes;

import ai.plantdata.Behavior.mode.CommandPattern.interfaces.Order;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: WangHui
 * @Date: 2020/12/23 11:19
 * @Description:
 */
public class Broker {
    private List<Order> orderList = new ArrayList<Order>();

    public void tackOrder(Order order){
        orderList.add(order);
    }

    public void placeOrders(){
        for (Order order : orderList) {
            order.execute();
        }
        orderList.clear();
    }
}
